<template>
  <van-action-bar>
    <van-action-bar-icon icon="chat-o" text="客服" />
    <van-action-bar-icon icon="cart-o" text="购物车" :badge="bardge" />
    <van-action-bar-icon icon="shop-o" text="店铺" />
    <van-action-bar-button type="warning" text="加入购物车" @click="addcar" />
    <van-action-bar-button type="danger" text="立即购买" @click="gocar" />
  </van-action-bar>
</template>

<script>
import { computed } from 'vue'
import { useStore } from 'vuex'
import { useRouter } from 'vue-router'
export default {
  setup(props, _) {
    const store = useStore()
    const router = useRouter()
    const bardge = computed(() => {
      return store.getters['car/goodsnum']
    })
    const addcar = () => {
      _.emit('addtocar')
    }
    const gocar = () => {
      router.push('/cart')
    }
    return {
      addcar,
      bardge,
      gocar
    }
  }
}
</script>

<style></style>
